/******************************************************************************************
 * Import
 ******************************************************************************************/
import _ from 'lodash';
import React, {Component} from 'react';
import { StyleSheet, TextInput, View, Dimensions } from 'react-native';
import Design from '../../../../design';
import Config from '../../../../config';
import ScreenBase from '../../../../library/base/screen';
import { Toast, SearchBar, Carousel } from 'antd-mobile-rn';
import { ListItem, CheckBox, Body, List, Button, Icon, Content,Text } from 'native-base';
// import SplashScreen from 'react-native-splash-screen';
import {
    CAround, CBetween, CCenter, CColumn, CHand, CItemX, CItemY, CLine, CRow, CWrap, 
    CIcon, CImage, CSvg, CText,
    CContent, CFloat, CFooter, CHeader, CPage, CSide, 
    CEmpty, CError, CFail, CSkeleton, 
    CLabel, CButton
} from '../../../../library/comp';
import {
    HttpText, HttpHesq
} from '../../../../library/func';

// svg
import Licon from '../../../../library/comp/project/icon';
import Item from 'antd-mobile-rn/lib/list/ListItem.native';



/******************************************************************************************
 * Export Class
 ******************************************************************************************/

export default class ProductList extends Component {

	/*------------------------------------------------------------------------------------
	 * 初始化
	 *-----------------------------------------------------------------------------------*/
	constructor(props) {
		super(props);

		this.shareImageArray = [];	// 所有分享图片的url地址数组
		this.shareImageSaved = 0;	// 已经保存好了多少张图片到相册
		this.shareImageIndex = 0;	// 最后一次已保存图片的索引
		this.shareImageDownloading = false; // 线程保护

		/**
		 * state
		 */
		this.state = {
			// 控制推广分享弹框显示隐藏
			shareBool: false,
		}
	}

	/*------------------------------------------------------------------------------------
	 * 渲染
	 *-----------------------------------------------------------------------------------*/
	render () {
		return (
			<CColumn ma='20' ba='2 #eaeaea' ra='30' oh>
				{/* 图片 */}
                <CLine>
                    <CImage source={{uri:this.props.data.object.set_image_home}} style={{width:'100%', height:130}}/>
                </CLine>

                {/* 文本 */}
					<CColumn pt='20' px='28'>
						<CLine y='top'>
							<CText bg='#fdf9ec' px='3' size='20' color='#cfb583' df >今日秒杀</CText>
                            {/* <CText pl='10' size='25' color='#333' bold style={{ flexWrap: "wrap"}}>{this.props.data.set_name}</CText> */}
                            <CHand f='1' oh>
                                <Text style={{ flexWrap: "wrap",color:'#333',fontSize:12,paddingLeft:7,fontWeight:'bold'}}>{this.props.data.set_name}</Text>
                            </CHand>
                            
						</CLine>
						<CBetween>
							<CLine>
								<CItemY pb='24' pt='8' x='left'>
									<CHand y='bottom' df>
										<CHand>
											<CText size='27'>￥</CText>
											<CText size='27' bold>{this.props.data.set_price}</CText>
										</CHand>
										{/* {
											this.props.isvip == 1 ?
												(
													<CHand ml='32'>
														<CText color='#c72e24' size='34'>赚</CText>
														<CText color='#c72e24' size='36'>￥</CText>
														<CText color='#c72e24' size='36'>{Math.floor(this.props.data.set_price*this.props.data.set_commission_percent)/100}</CText>
													</CHand>
												)
												:
												( */}
													<CText size='25' ml='10' color='#999'  style={{textDecorationLine: 'line-through'}}>￥{this.props.data.set_original_price}</CText>
												{/* )
										} */}
										
									</CHand>
									<CText color='#afafaf' mt='8' size='20'>销量{this.props.data.count_sale}</CText>
								</CItemY>
							</CLine>
							<CLine x='right'>
                                {/* <CSvg onClick={ this.subCart.bind(this, this.props.data) } icon={Icon.cart} w='60' h='60' ></CSvg> */}
                                <CIcon icon={Licon["shop-gouwche"]} w='50' h='50' color='#d61518' />
								{/* {
									this.props.isvip == 1 && <CIcon icon={Licon["person-center-share"]} w='30' h='30' color='#d61518' />
									// this.props.isvip == 1 && <CSvg onClick={this.share.bind(this, this.props.data)} icon={Icon.share} w='40' h='40' ml='30' color='#666'></CSvg>
								} */}
							</CLine>
						</CBetween>
					</CColumn>
            </CColumn>
		)
	}
}

